package com.time.oss.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * minio配置管理
 *
 * @author: HuangQi
 * @date: Created in 18:41 2025/11/25
 * @description: minio配置管理类
 */
@Configuration
public class MinioConfig {

    /**
     * minio服务地址
     */
    @Value("${minio.url}")
    private String url;

    /**
     * minio登录账号
     */
    @Value("${minio.accessKey}")
    private String accessKey;

    /**
     * minio登录密码
     */
    @Value("${minio.secretKey}")
    private String secretKey;

    /**
     * 构造minio客户端
     *
     * @return minioclient
     */
    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder()
                .endpoint(url)
                .credentials(accessKey, secretKey)
                .build();
    }


}
